System and method for dynamic generation of remote proxies

ABSTRACT

A software system is disclosed which provides for dynamic generation of remote proxy classes at run time through a distributed object management system  16 . The software system provides for a client system  14  and server system  12  which communicate via distributed object management system  16  which operates over a distributed computer network to allow communications between client system  14  and server system  12 . Any inter-object communication will invoke a remote proxy generation control module  34  if a remote proxy class  23  does not already exist for the requested subject object  18 . A remote proxy generation control module  34  is provided which first invokes reflection engine  36  to determine the applicable information of subject class  19 . Next, a communication enabling module  40  determines and inserts the appropriate computer code to allow local object  20  to communicate with subject object  18  utilizing remote proxy object  22 . After the system determines what information is required by remote proxy class  23 , byte code generator  42  automatically generates the executable code containing remote proxy class  23 . Finally, class loader  46  loads remote proxy class  23  onto the system and creates a new instance which is remote proxy object  22.

RELATED APPLICATIONS

This application is a continuation of pending U.S. application Ser. No.09/451,507, which is a continuation-in-part application of U.S.application Ser. No. 09/175,079 now U.S. Pat. No. 6,385,661.

TECHNICAL FIELD OF THE INVENTION

This invention relates in general to the field of software systems, andmore particularly to an improved system and method for dynamicgeneration of remote proxy classes within a distributed objectmanagement system.

BACKGROUND OF THE INVENTION

Object oriented programming is a method of programming which abstracts acomputer program into manageable sections. The key to object orientedprogramming is the concept of encapsulation. Encapsulation is a methodby which the subroutines, or methods, that manipulate data are combinedwith the declaration and storage of that data. This encapsulationprevents the data from arbitrarily being accessed by other programsubroutines, or objects. When an object is invoked, the associated datais available and can be manipulated by any of the methods which aredefined within the object to act upon the data. The basic component ofencapsulation is a class. A class is an abstraction for a set of objectsthat share the same structure and behavior. An object is a singleinstance of a class that retains the structure and behavior of theclass. Objects also contain methods which are the processes by which anobject is instructed to perform some procedure or manipulation of datawhich it controls. Classes may also be characterized by their interfacewhich defines the elements necessary for proper communication betweenobjects.

Distributed computing allows an object on one computer system toseamlessly communicate with and manipulate an object contained in asecond computer system when these computers are connected with acomputer network. This second computer system may also be referred to asanother address space. Sophisticated distributed computing systems haveremoved the communications burden from the computer programs, or objectsin an object oriented programming environment, and placed it in amid-level operating system which purpose is to manage communicationsacross a computer network to facilitate a client's access to andmanipulation of data contained on a server system, for example, acomputer remote to the user in a different address space.

Distributed computing and object oriented programming have led to thedevelopment of distributed object management systems. When an object ona client computer system requests access to an object which exists onlyon a server computer system, the distributed object management systemsteps in to facilitate the communication between the two computersystems and, thus, between the two objects. The distributed objectmanagement system removes the requirement of the object on the clientsystem communicating directly with the object on the server system.Instead, current distributed object management systems create a remoteproxy object on the client system which models the interface of theobject which exists on the server system. The client computer systemwhich requested access to the remote object communicates with the remoteproxy object which now exists on the client computer system. Therefore,the client computer system can operate as if it is communicatingdirectly with a local object. The remote proxy object contains thenecessary communications information to allow the client computer systemto access and manipulate an object which actually exists on the servercomputer system. Remote proxies allow the client system to disregard thelocation of the requested object and the communication details.

A proxy is an object which has an interface and method list identical toanother object. However, it does not contain the same detail computerprogramming. Instead it contains communications requirements which allowthe proxy to communicate directly with another object without theknowledge of the first object. Proxies can be used to control access tocertain objects. They may also be used to remove the labor ofdistributed processing communications from local objects. For example,if object A which resides on a first computer system needs tocommunicate with object B which resides on a second computer system,object A must know the location of object B and have the necessarycomputer code to initiate communications with object B located on thesecond computer system. A proxy for object B located on the firstcomputer system allows object A to simply communicate with the proxy ofobject B as if object B resided on the same computer. The proxy forObject B has all the necessary information and computer code tocommunicate with the real object B on the second computer system. Thistype of proxy is known as a remote proxy since it exists on a computersystem remote from the computer system which contains the requestedobject.

Systems heretofore known have required all possible remote proxies to bebuilt when the software system is initially compiled and loaded onto acomputer. This process can be very time consuming and the resultantremote proxies can require large amounts of computer storage. Inaddition, software system designers must predict every possible remoteproxy which may be needed in the future so that it can be built when thesoftware system is loaded. This process does not allow a system to adaptto its usage and environment.

SUMMARY OF THE INVENTION

Accordingly, a need has arisen for a software system in the area ofdistributed processing which reduces the time and expense required tobuild, load and store a distributed object management system.

According to one embodiment of the present invention, a software systemis provided that comprises a client system and server system thatcommunicate via a distributed computer network utilizing a distributedobject management system. The distributed object management system alsocomprises a remote proxy generator to dynamically generate at run timeremote proxy classes as needed for inter-object communications withinthe distributed computer network.

One important technical advantage of the present invention inheres inthe fact that it decreases development time and increases developerproductivity since the developer does not have to manually generate theremote proxy classes when the system is initially installed or when thesubject class is modified in the future. Other technical advantagesinclude reduced initial system build time and reduced disk storage spacerequired to store the application programs.

BRIEF DESCRIPTION OF THE DRAWINGS

For a more complete understanding of the present invention and theadvantages thereof, reference is now made to the following descriptiontaken in conjunction with the accompanying drawings in which likereference numbers indicate like features and wherein:

FIG. 1 is a block diagram illustrating a distributed object managementsystem constructed according to the teachings of the present invention;

FIG. 2 illustrates a flow chart of a method of determining when dynamicgeneration of remote proxy classes is needed according to the teachingsof the present invention;

FIG. 3 is a block diagram illustrating dynamic generation of remoteproxy classes according to the teachings of the present invention; and

FIG. 4 illustrates a flow chart of a method of dynamically generatingremote proxy classes according to the teachings of the presentinvention.

DETAILED DESCRIPTION OF THE INVENTION

Referring to FIG. 1, a distributed processing computer system generallyindicated at 10 is illustrated that comprises one or more server systems12 and one or more client systems 14. The client/server computer systemsallow for decentralized computing which includes the ability tomanipulate data which is resident on a remote system. The server system12 and client system 14 may comprise a personal computer, mini computer,main frame computer, or any other suitable computer type device. In acomputer network environment, each computer is assigned a uniqueaddress. Therefore, if data, code or objects exist on a differentcomputer, it is said to exist in a different address space.

The client system 14 requests access to data or services which may becontained on server system 12. Server system 12 may then process therequest and approve access as requested by client system 14. Clientsystem 14 is connected to server system 12 via a distributed objectmanagement system 16 operating across a computer network. Thedistributed object management system 16 handles the communicationsbetween client system 14 and server system 12. Without distributedobject management system 16, distributed processing could not take placesince client system 14 would not be able to determine the location of orobtain access to the requested data or services. The distributed objectmanagement system 16 may comprise Voyager, a distributed networkcommunications system developed by ObjectSpace, Inc., CORBA (CommonObject Request Broker Architecture), a technology for inter-objectcommunications developed by a consortium of companies, DCOM, aninter-application communications system for networked computersdeveloped by Microsoft, or any other suitable distributed objectmanagement system.

The present invention teaches a system and method for generating proxieson local systems to facilitate access to objects on remote systems. Anobject is an instance of a class within the programming methodology ofobject oriented programming. The present invention may be implementedusing the Java language, developed by Sun Micro Systems, Inc., or anyother suitable computer language.

When an object class source code description is created in the Javalanguage, it is stored on a storage device as a java file. Uponcompilation, the object class executable code is represented as a classfile on the storage device. When an object is needed, a new instance, asprescribed by the class file is created, and it then is referred to asan object. Server system 12 may contain one or more subject objects 18for which client system 14 may issue a request for access. In such acase, subject object 18 is the subject of client system's 14 request.Client system 14 may contain one or more local objects 20. It isimportant to note that local object 20 can itself be a subject object,and subject object 18 can itself be a local object depending on whatcomputer, or address space, is making the request for access. Forpurposes of illustrating the present invention, local object 20 andsubject object 18 exist in different address spaces. However, both localobject 20 and subject object 18 could reside on the same computer andstill invoke the system and method of the present invention. The presentinvention is utilized in all inter-object communications regardless oftheir relative locations.

Local object 20 may request access to subject object 18. This requestinvokes the distributed object management system 16. In order to isolatethe distributed processing communication requirements from local object20, a remote proxy object 22 may be created on client system 14. Remoteproxy object 22 has an interface and list of methods identical tosubject object 18. Remote proxy object 22 is so named since it may beremote from subject object 18, and it provides a local representativefor an object which may reside in a different address space. Remoteproxies in general are responsible for encoding a request and itsarguments and for sending the encoded request to the subject objectwhich may exist in a different address space. Remote proxies also hidethe location of the subject object from the requesting local object.Therefore, any local object can assume, from an access point of view,that any object it needs is local. Local object 20 communicates withremote proxy object 22 which then communicates with subject object 18via distributed object management system 16. By doing this, local object20 is unconcerned with the location of subject object 18. As far as itis concerned, local object 20 is communicating directly with anotherlocal object, but in reality, it is communicating with subject object 18which may reside in a different address space.

Currently, a system developer must anticipate all necessary remoteproxies and create the remote proxy classes. Some distributed objectmanagement systems have a utility which augments the build process byallowing remote proxy classes to be built when the system is compiled.Although this process minimizes the system developer's effort, it stillinvolves developer intervention, computer resources and time. Anotherdisadvantage with current distributed object management systems is thatthese remote proxy classes must be kept in sync with the subject classesas the subject classes and interfaces are modified. Another disadvantagewith current distributed object management systems is that all remoteproxy classes must be stored on the computer and available for use whenneeded. This creates high overhead in developer effort, computer storageand processing requirements.

In contrast, a system constructed using the present inventiondynamically generates remote proxy classes as needed at run-time. Thereare several advantages of this method. The primary advantage is reducedsystem development time since the system developer does not have tomanually generate remote proxy classes when the system is initiallycompiled or manually regenerate remote proxy classes each time a subjectobject class is modified. The system of the present invention alsoreduces computer program storage requirements since remote proxy classesare not a permanent part of the operating environment. It also minimizescompile and load time for the computer program since remote proxyclasses do not have to be generated at compile and load time. In orderto optimize system performance, generated remote proxy classes remain inmemory until the distributed object management system is shut down.

Referring again to FIG. 1, the dynamic generation of remote proxies maybe accomplished by parsing the .class or java file for subject object 18and creating a .java file for remote proxy object 22 which contains theinterfaces and methods of the subject object 18. The Java compiler maythen be invoked to compile the .java file into a .class file for remoteproxy object 22. The compiled .class file can then be loaded into thecomputer system via a class loader which is a standard element in a Javaenvironment. A .class file must be loaded before it is available for useby distributed processing computer system 10. Once the .class file isloaded, a new instance of the compiled .class file may be created whichwill be remote proxy object 22.

The process of parsing the subject object 18 class (subject class 19) or.java file, creating a source code file for remote proxy class 23,compiling, loading, and creating a new instance may be excessively slowat run-time. In order to address this issue, a reflection process may beused on subject object 18 to determine its name, interfaces and list ofmethods and then to directly generate the byte codes into a .class file,subject class 19. The byte codes are the executable code stored in aclass file. The class file can then be loaded into the computer systemwith the class loader. This embodiment eliminates the need to parse the.class file, create a .java source code file, and shell out the .javafile to a compiler since the code generation process occurs as part ofthe dynamic generation of remote proxies. This entire process of dynamicgeneration of remote proxies will be discussed in detail with referenceto FIGS. 2, 3 and 4.

Referring to FIG. 2, the process of determining if a remote proxy isnecessary is invoked via a request from local object 20 for access tosubject object 18. The method begins at step 24 where local object 20 onclient system 14 requests access to subject object 18 on server system12. This request could be for any object whether it is local or remoteand in a different address space. The system of the present inventiongenerates and utilizes remote proxy objects in all inter-objectcommunication to provide additional processing support. Thus, anycommunication between objects, regardless of their location, utilizesremote proxy objects. These remote proxy objects act as a middle manbetween the requested object and the requesting object to provideadditional processing functionality which may include increasedsecurity.

Referring again to FIG. 2, the method then proceeds to step 26 where therequested object is located on either client system 14 or server system12. The method proceeds to step 30 where a determination is maderegarding the need for a remote proxy class. If remote proxy class 23already exists on client system 14, then the method terminates sinceremote proxy classes are not removed from client system 14 until thedistributed object management system 16 is shut down. However, if remoteproxy class 23 does not exist on client system 14, the method thenproceeds to step 32 where remote proxy class 23 is generated on clientsystem 14 based on the name, interfaces and methods of subject object 18which may reside on either server system 12 or client system 14. Themethod for generating these remote proxies is described in detail withreference to FIGS. 3 and 4.

FIG. 3 is a functional diagram of the portions of distributed objectmanagement system 16 that are used to create remote proxy classes asnecessary. Remote proxy generation control module 34 is invoked at step32 in FIG. 2. When the distributed object management system 16 invokesthe remote proxy generation control module 34, the method describedpreviously has already determined that the remote proxy class 23 doesnot yet exist on client system 14. Remote proxy generation controlmodule 34 generates remote proxy 22 on client system 14 so local object20 can communicate with subject object 18 via distributed objectmanagement system 16.

As previously discussed, in object oriented programming, an object is aninstance of a class. Classes may be defined in a class hierarchy whereeach class inherits the attributes of all of its ancestors. Inheritanceis a concept which maps related classes onto each other in ahierarchical way. This allows a descendant of a class to inherit all ofits variables and methods from its ancestors as well as create its own.The immediate ancestor of a class is known as its superclass. Therefore,in order to determine all of a class's attributes, all of the class'sancestors, or superclasses, must be determined.

To fully define a remote proxy for a subject object, remote proxies mustbe generated for each of the subject object's superclasses. Bygenerating these superclass remote proxies, the remote proxy for subjectobject will inherit all of the variables and methods of its ancestors,or superclasses. An alternative to generating superclass remote proxiesincludes adding all of the superclass methods and interface requirementsto the remote proxy class. By adding the superclass information to theremote proxy class, the need for generating superclass remote proxies iseliminated.

Referring again to FIG. 3, remote proxy generation control module 34first invokes reflection engine 36 to determine information regardingsubject class 19. The process of reflection operates on subject class 19which is the Java .class file for subject object 18. Although forillustrative purposes, subject object 18 and its Java .class file,subject class 19, exist on server system 12, subject class 19 couldexist on either client system 14 or server system 12. Therefore, thedynamic generation of remote proxy classes as described in the presentinvention could take place on either client system 14 or server system12.

Reflection is a process that determines what an object can do, how it isdefined, and how it communicates with other objects. Reflection mirrorsthe public view of an object to collect information to facilitate thecreation of proxies which resemble objects on the public view, but arevery different internally, or privately. The public view of an objectrepresents the information external objects must know in order tocommunicate with the first object. Proxies need to be reflections, orduplicates on the surface, of objects since proxies perform specifictasks such as controlling access to or communications with the objectsthey represent. Thus, proxies need to look like the object on theoutside, but on the inside, proxies contain unique computer code toaccomplish their assigned function. The reflection process is onlyconcerned with determining the public view of an object. Therefore, theinformation determined by the reflection process includes the following:name; list of implemented interfaces; list of methods; and superclassinformation.

Continuing with FIG. 3, reflection engine 36 issues queries againstsubject class 19, which is the .class file for subject object 18, todetermine each of subject class 19 superclasses, its name, itsinterfaces, and each of its methods. The results of these queries aretemporarily stored within remote proxy generation control module 34 asJClass information 38. JClass information 38 is a temporary storage areawhich defines the name, superclasses, interfaces, and methods of subjectclass 19. JClass information 38 would also include the name, interfaces,and methods of each of subject class 19 superclasses.

If subject class 19 has superclasses, a remote proxy may be firstgenerated for each superclass using the system and method described withreference to the present invention. After the superclass remote proxiesare generated, JClass information 38 contains the name, interface, andlist of methods for subject class 19. An alternate methodology forproviding superclass methods and interfaces for the remote proxy classis to add all superclass method and interface information to the remoteproxy class. By doing this, the need for separate superclass remoteproxies is eliminated.

Once the name, interface, methods, and superclass information aredetermined for subject class 19, a communication enabling module 40 addsto JClass information 38 the computer code necessary for remote proxyobject 22 to communicate with subject object 18 via distributed objectmanagement system 16. The communication enabling module 40 inserts thecomputer code into JClass information 38 which is the definition of allthe information that remote proxy object 22 needs to function withindistributed object management system 16.

Since a remote proxy's purpose is to communicate with a subject objectwhich may exist either in a different address space or in the sameaddress space, the remote proxy contains essentially only the followinginformation: interfaces identical to the subject object; a list ofmethods identical to the subject object; and computer code necessary forthe remote proxy to communicate with the subject object. In an alternateembodiment of the present invention, the remote proxy would contain allof the information mentioned above and the interfaces and methods of allof the subject object's superclasses.

At this point, JClass information 38 contains subject object's 18 name,interfaces, methods, and the computer code necessary for communicationswithin distributed object management system 16. JClass information 38could also contain the superclass information for subject object 18. Thenext function invoked by remote proxy generation control module 34 isbyte code generator 42. The purpose of byte code generator 42 is todirectly generate the executable code corresponding to JClassinformation 38. JClass information 38 is the definition of the Javaclass of which remote proxy object 22 is an instance. That is, JClassinformation 38 is the definition of remote proxy class 23. Byte codegenerator 42 reviews JClass information 38 and generates thecorresponding byte codes, or executable code, into remote proxy class 23which is a Java class file. As previously discussed, a Java class fileis executable code which defines a Java class.

Byte code generator 42 is a collection of Java classes which are capableof taking the description of the needed proxy class in JClassinformation 38 and directly generating the executable Java code inmemory. The function of byte code generator 42 is similar to that of aJava compiler. Like a Java compiler, byte code generator 42 generatesexecutable Java code. However, the inputs are very different. A compilerrequires a source code file which is a string of bytes which is thesequence of statements for a Java object definition. The string of bytesis parsed by the Java compiler and translated into executable Java code.In contrast, byte code generator 42 takes general information regardingthe needed Java object and directly generates executable Java codewithout the need for the intermediate step of creating a Java sourcefile. This technique yields considerable time savings since severalsteps are omitted. For example, like a Java compiler, byte codegenerator 42 generates a hexadecimal “CAFEBABE” to indicate to the Javavirtual machine that a Java class file begins at that point in memory.Byte code generator 42 is constructed in such a way that the byte codesare generated in the sequence required by the Java virtual machine.

For each Java construct, byte code generator 42 writes the appropriateheader information and hexadecimal byte codes representing the Javaconstruct into computer memory. Thus, there is a block of code, orhexadecimal bytes, for each Java construct. As described above, JClassinformation 38 contains the computer code necessary for communicationswithin distributed object management system 16. Byte code generator 42translates this communications information into byte codes recognizableto the Java virtual machine. When byte code generator 42 terminates, thestring of hexadecimal bytes necessary to define the proxy class has beenstored in memory as remote proxy class 23 which is an executable Javaclass file. Remote proxy class 23 has a unique name which is derivedfrom subject class 19 name. For example, if subject class 19 is named“Foo.class”, its remote proxy class 23 name would be “Foo_Proxy.class”.

Before remote proxy class 23 can be used, it must be loaded onto clientsystem 14 utilizing a class loader 46. Class loader 46 may comprise anynumber of suitable programs which exist in typical object orientedprogramming environments. The class loader 46 will then create remoteproxy object 22 which is an instance of remote proxy class 23 generatedby byte code generator 42.

FIG. 4 is a flow diagram that illustrates the process of generating aremote proxy when invoked by step 32 in FIG. 2 and as represented ingeneral by the block diagram in FIG. 3. The method begins at step 48where the reflection engine 38 queries subject class 19 to determine itssuperclass. The method then proceeds to step 50 where a determination ismade regarding the existence of a superclass for subject class 19. If asuperclass is found for subject class 19, then the method proceeds tostep 52 where a determination is made regarding the existence of theremote proxy class on client system 14 representing subject class' 19superclass. If a remote proxy class does not exist for subject class' 19superclass, the method proceeds to step 54 where the remote proxy classis generated for subject class' 19 superclass by recursively invokingthe remote proxy generation control module 34. Thus, step 54 recursivelyinvokes the method illustrated in FIG. 4.

Referring to step 52, if the remote proxy class does exist on clientsystem 14 for subject class' 19 superclass, then the method proceeds tostep 56 (described below) since remote proxy classes already exist forall of subject object's 18 superclasses.

In an alternate embodiment of the present invention, instead ofrecursively generating remote proxy classes for each of subject class 19superclasses, the interfaces and methods of each of subject class 19superclasses are stored in JClass information 38 and are later used inthe generation of remote proxy class 23. In the alternate embodiment,steps 48-54 would not exist in their current form. Instead, these stepswould consist of determining the names, interfaces, and methods of allof subject class 19 superclasses and storing the information in JClassinformation 38.

Referring to step 50 if a superclass does not exist for subject object18, then the method proceeds to step 56 where reflection engine 36queries subject class 19 to determine subject class' 19 name andinterface. The method then proceeds to step 58 where reflection engine38 queries subject class 19 regarding its methods. Reflection engine 36issues queries for each of subject class' 19 methods until all methodsare determined. For each of subject class' 19 methods, the softwaresystem determines the method name, return type, parameters, andexceptions and stores the information in JClass information 38.

The method then proceeds to step 60 where reflection engine 36 createsJClass information 38 from the name, interface, and methods informationdetermined in steps 56 and 58. The method then proceeds to step 62 wherecommunication enabling module 40 inserts in JClass information 38 thecomputer code, in the form of an expression tree, necessary for remoteproxy object 22 to communicate with subject object 18 via distributedobject management system 16.

The method then proceeds to step 64 where byte code generator 42generates the executable code representing JClass information 38 intoremote proxy class 23. The method then proceeds to step 66 where classloader 46 loads remote proxy class 23 onto client system 14 where it isnow available for use. The method then proceeds to step 68 where remoteproxy object 22 is generated as a new instance of remote proxy class 23which was loaded in step 66.

According to the teachings of the present invention, a software systemis provided that allows for the dynamic generation of remote proxyclasses. The advantages of dynamic generation of remote proxy classesincludes reduced system development time, reduced system compile andbuild time, reduced system modification time, and reduced system storagerequirements. Remote proxy classes are generated as needed at run time.Once a remote proxy class is generated, it continues to exist until thesystem is shut down. Therefore, the software system is only required togenerate a particular remote proxy class once during a session of thesoftware system.

Although the present invention and its advantages have been described indetail, it should be understood that various changes, substitutions andalterations can be made therein without departing from the spirit andscope of the invention as defined by the appended claims.

1. A remote proxy generator for dynamic generation of remote proxyclasses within an object oriented distributed processing environment,comprising: a reflection engine operable to determine the name,interfaces, methods and superclass information of a remote object withinthe object oriented distributed processing environment for use increating the remote proxy class in response to a request for access tothe remote object; a communications enabling module operable to aid increating the remote proxy class by inserting within the remote proxyclass computer code required for communications between objects withinthe object oriented distributed processing environment; and a byte codegenerator operable to generate the executable computer code representingthe determined name, interfaces, methods, superclass information andcommunications computer code for the remote proxy class.